#面向对象
#封装继承和多态
# class Animal:
#     name = "animal"
#     def shout(self):
#         print("animal shout")
#
# animal = Animal()
# print(animal.name)
# animal.shout()


class Dog:
    name = 'dog'
    def __init__(self):
        self.age = 10#构造函数
    def eat(self):
        print("dog eat")

dog = Dog()
print(dog.name)
dog.eat()

dog1 = Dog()
print(dog1.name)
print(Dog.name)
print('-----------')

dog1.name = "dddddd1"
print(dog1.name)
print(Dog.name)
print('------------')
Dog.name="-dd1"
print(Dog.name)
print(dog1.name)
print("--------------")
dog2 = Dog()
print(dog2.name)
print(dog2.age)


class  Cat():
    def __init__(self,name):
        self.name = name
    def speak(cls):#类方法
        print("shout~~~~~~~~~``")
    def miao(self):
        print("miao~~~~~~")

cat =Cat('小白')
print(cat.name)
cat.miao()
# print(Cat.name)#实例属性不能通过类来调用
Cat.speak()



